<?php
class jobsModel extends Model{
	private $tb = 'jobs';

	public function __construct(){
		parent::__construct($this->tb);
	}

	public function add_jobs($data){
		if( empty($data['name']) || empty($data['location']) ){
			$this->error( lang( array('required_fields','required') ) );
			return false;
		}
		if( empty($data['experience']) ) $data['experience'] = 0;
		return $this->value($data)->add();
	}

	public function get_jobs($where="", $limit="", $order=""){
		return $this->where($where)->limit($limit)->order($order)->get();
	}

	public function edit_jobs($id, $data){
		$id = intval($id);
		if( empty($id) || empty($data['name']) || empty($data['location']) ){
			$this->error( lang( array('required_fields','required') ) );
			return false;
		}
		if( empty($data['experience']) ) $data['experience'] = 0;
		return $this->where(array('id'=>$id))->value($data)->update();
	}

	public function del_jobs($id){
	
	}
}
